﻿using IconYuan.Model.Entity.Products;
using SqlSugar;
using System;

namespace IconYuan.Model.Entity.Orders
{
    /// <summary>
    /// 订单商品
    /// </summary>
    [SugarTable("t_order_goods")]
    public class OrderGoods
    {
        /// <summary>
        /// 自增id
        /// </summary>
        [SugarColumn(IsPrimaryKey = true)]
        public int order_goods_id { get; set; }
        /// <summary>
        /// 用户id
        /// </summary>
        public int user_id { get; set; }
        /// <summary>
        /// 订单id
        /// </summary>
        public int order_id { get; set; }
        /// <summary>
        /// 商品ID
        /// </summary>
        public int goods_id { get; set; }
        /// <summary>
        /// 商品名称
        /// </summary>
        public string goods_name { get; set; }
        /// <summary>
        /// 商品编码
        /// </summary>
        public string goods_no { get; set; }
        /// <summary>
        /// 库存计算方式(10下单减库存 20付款减库存)
        /// </summary>
        public int deduct_stock_type { get; set; }
        /// <summary>
        /// 规格类型(10单规格 20多规格)
        /// </summary>
        public int spec_type { get; set; }
        /// <summary>
        /// 商品sku id,格式：100_101
        /// </summary>
        public string goods_sku_id { get; set; }
        /// <summary>
        /// SKU 关联的多个规格(json格式)
        /// </summary>
        public string goods_props { get; set; }
        /// <summary>
        /// 商品单价
        /// </summary>
        public decimal goods_price { get; set; }
        /// <summary>
        /// 划线单价
        /// </summary>
        public decimal line_price { get; set; }
        /// <summary>
        /// 实际付款价(折扣和优惠后)
        /// </summary>
        public decimal pay_price { get; set; }
        /// <summary>
        /// 会员折扣比例(0-10)
        /// </summary>
        public int grade_ratio { get; set; }
        /// <summary>
        /// 优惠券抵扣金额
        /// </summary>
        public decimal coupon_money { get; set; }
        /// <summary>
        /// 积分抵扣金额
        /// </summary>
        public decimal points_money { get; set; }
        /// <summary>
        /// 积分抵扣数量
        /// </summary>
        public int points_num { get; set; }
        /// <summary>
        /// 促销抵扣金额
        /// </summary>
        public decimal promotion_money { get; set; }
        /// <summary>
        /// 促销ID
        /// </summary>
        public int promotion_id{ get; set; }
        /// <summary>
        /// 购买数量
        /// </summary>
        public int buy_count { get; set; }
        /// <summary>
        /// 商品重量(Kg)
        /// </summary>
        public float goods_weight { get; set; }
        public DateTime create_time { get; set; }

        /// <summary>
        /// 商品主图url
        /// </summary>
        public string goods_image { get; set; } = string.Empty;
        /// <summary>
        /// 价格单位描述
        /// </summary>
        public string price_desc { get; set; }
        /// <summary>
        /// 商品分类
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public int category_id { get; set; }

        /// <summary>
        /// 是否开启等级折扣 (1开启 0关闭)
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public int is_enable_grade { get; set; } = 0;
        /// <summary>
        /// SKU信息
        /// </summary>
        [SugarColumn(IsIgnore =true)]
        public Sku skuInfo{ get; set; }

        ///// <summary>
        ///// 按等级折扣后的单价
        ///// </summary>
        //public decimal grade_goods_price { get; set; }

        ///// <summary>
        ///// 商品封面图ID
        ///// </summary>
        //public int image_id { get; set; }
        ///// <summary>
        ///// 是否存在会员等级折扣
        ///// </summary>
        //public int is_user_grade { get; set; }
    }
}
